<?php
/**
 * Utility functions for Netflix Service Wrapper.
 * 
 * @author Armando Padilla, armando_padilla_81@yahoo.com
 * @package Zend_Service_Netflix
 */
class Zend_Service_Netflix_Utils {
	
	/**
	 * Parse the ID from the URL of a 
	 * cast, director, etc.
	 *
	 * @param unknown_type $string
	 */
	public function parsePersonId($string){
		
		$elements = explode("/", $string);
		$id 	  = $elements[count($elements)-1];
		
		return $id;
		
	}
	
	/**
	 * Parse the ID from the URL of a 
	 * title.
	 *
	 * @param unknown_type $string
	 */
	public function parseTitleId($string){
		
		$elements = explode("/", $string);
		$id 	  = $elements[count($elements)-1];
		
		return $id;
		
	}
	
	/**
	 * Parse the Series ID from the URL of a 
	 * title.
	 *
	 * @param unknown_type $string
	 */
	public function parseSeriesId($string){
		
		$elements = explode("/", $string);
		
		$id = "";
		
		if(isset($elements[6])){
			$id = $elements[6];
		}
		
		return $id;
		
	}
	
	/**
	 * Parse the Season ID from the URL of a 
	 * title.
	 *
	 * @param unknown_type $string
	 */
	public function parseSeasonId($string){
		
		$elements = explode("/", $string);
		
		$id = "";
		if(isset($elements[8])){
			$id = $elements[8];
		}
		
		return $id;
		
	}
}